package J5938;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 周赛：
 * 找出数组排序后的目标下标：
 */
public class Test {
    public static void main(String[] args) {
        System.out.println(new Solution().targetIndices(new int[]{1, 2, 5, 2, 3}, 2));
    }
}

class Solution {
    public List<Integer> targetIndices(int[] nums, int target) {
        List<Integer> list = new ArrayList<>();
        if (nums.length == 0) {
            return list;
        }
        Arrays.sort(nums);
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] == target){
                list.add(i);
            }
        }
        return list;
    }
}
